export function isvalidPhone(phone) {
	const reg = /^1([38][0-9]|4[014-9]|[59][0-35-9]|6[2567]|7[0-8])\d{8}$/
	return reg.test(phone)
}
export function confirmPass(newOld,value) {
	return newOld=== value
}
// 数据脱敏显示
export function formatShow(value, rule) {
	switch (rule) {
		case 'phone':
			return value.replace(/(\d{3})(\d{4})(\d{4})/g, '$1****$3');
		case 'idCode':
		case 'identity':
		case 'identityNo':
		case 'identityCardCode':
			return value.replace(/(\d{3})(\d{12})(\d{3})/g, '$1************$3');
		default:
			return value;
	}
}
// 图片转换
export function getImgUrl(value) {
	let descFileIds = []
	if (value) {
		descFileIds = value.indexOf(",") != -1 ? value.split(",") : [value]
	}
	return descFileIds
}
//时间对比
export function judgeTime(strtTime, endTime) {
	var dayTime = new Date().getFullYear() + '-' + (new Date().getMonth() + 1) + '-' + new Date().getDate()
	var strtime = dayTime + ' ' + strtTime
	var endtime = dayTime + ' ' + endTime
	var date1 = new Date(strtime);
	var date2 = new Date(endtime);
	console.log(date1, date2)
	return date1 < date2 ? true : false;
}

//json 转字符串
export function Stringify(val){
	return JSON.stringify(val)
}
//字符串转json
export function JsonParse(val){
	return JSON.parse(val);
}
//判断是否是图片格式
export function isAssetTypeAnImage(filePath) {
 //文件路径 var filePath 
 //获取最后一个.的位置
 var index= filePath.lastIndexOf(".");
 //获取后缀
 var ext = filePath.substr(index+1);
 //输出结果
 // console.log("图片",ext);
 return [
 'png', 'jpg', 'jpeg', 'bmp', 'gif', 'webp', 'psd', 'svg', 'tiff'].
 indexOf(ext.toLowerCase()) !== -1;
}
